﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure.Web.Extensions;
using System.Web;
using Microsoft.Practices.Unity;
using System.Threading;
using System.Web.Security;
namespace Infrastructure.Web.Views
{
    public class Page : System.Web.UI.Page
    {
        protected override void InitializeCulture()
        {
            if (!DesignMode)
            {
                var container = HttpContext.Current.Application.GetContainer();

            }
                
            //var session = container.Resolve<Services.ISessionService>();
            //Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(session.Culture);
            //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(session.Culture);
        }
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);


            

            

            //TODO: Urgente Actions
             //if (!UrlAuthorizationModule.CheckUrlAccessForPrincipal(this.AppRelativeVirtualPath, HttpContext.Current.User, HttpContext.Current.Request.HttpMethod))
             //   throw new HttpException(403, "Access is denied");
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);            
            if (!this.DesignMode)
                HttpContext.Current.Application.BuildWebUIElement(this);            
        }
    }
}
